<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <#include "/back/common.html">
    <script type="text/javascript" src="/back/edit/wangEditor.min.js"></script>
    <!--<link rel="stylesheet" href="/back/layui/css/layui.css">-->
    <!--<link rel="stylesheet" href="/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css">-->
    <!--<script src="/back/js/jquery.min.js"></script>
    <script src="/back/layui/layui.js"></script>-->
    <!--<script type="text/javascript" src="/zTree/js/jquery.ztree.all.js"></script>-->
    <!--<script type="text/javascript" src="/js/myTree.js"></script>-->
    <style>
        .layui-btn-primary:hover {
            background-color: #f8ac59;
            border-color: #f8ac59;
            color: #fff;
        }
    </style>
</head>
<body>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>商品信息</legend>
</fieldset>

<form class="layui-form" id="userForm">
    <input type="hidden" id="pk" name="pk" value="${mv.pk}">
    <div class="layui-form-item">
            <label class="layui-form-label"><font color="red">※</font>一级分类</label>
            <div class="layui-input-inline" >
                <select class="layui-select" id="productTypeFirst" name="productTypeFirst"
                        lay-search="" lay-verify="notNull" lay-filter="productTypeFirst">
                    <option value="-1" selected="selected">输入一级分类名称搜索</option>
                    <#if firstProductTypeList?? && firstProductTypeList?size &gt;0>
                        <#list firstProductTypeList as item>
                            <tr>
                                <option value="${item.pk}">${item.product_type_name}</option>
                            </tr>
                        </#list>
                    </#if>
                </select>
                <script>
                    $("#productTypeFirst").val("${mv.product_type_first}");
                </script>
            </div>

            <label class="layui-form-label"><font color="red">※</font>二级分类</label>
            <div class="layui-input-inline">
                <select class="layui-select" id="productTypeSecond" name="productTypeSecond" lay-search="" lay-verify="notNull">
                    <option value="-1">输入二级分类名称搜索</option>
                </select>
            </div>

            <label class="layui-form-label"><font color="red">※</font>商品名称</label>
            <div class="layui-input-inline">
                <input type="text" name="productName"  id="productName" value="${mv.product_name}"
                       lay-verify="notNull" autocomplete="off"
                       class="layui-input">
            </div>

            <label class="layui-form-label"><font color="red">※</font>商品价格</label>
            <div class="layui-input-inline">
                <input type="text" name="productPrice" id="productPrice" value="${mv.product_price}" lay-verify="notNull" autocomplete="off"
                       class="layui-input">
            </div>

        </div>
    </div>

    <div class="layui-form-item">
        <!--<label class="layui-form-label">商品价格单位</label>
        <div class="layui-input-inline">
            <input type="text" name="priceUnit" id="priceUnit" value="${mv.price_unit}" lay-ignore="true" autocomplete="off"
                   class="layui-input">
        </div>-->
        <label class="layui-form-label">商品折后价</label>
        <div class="layui-input-inline">
            <input type="text" name="productSale" id="productSale" value="${mv.product_sale}" autocomplete="off"
                   class="layui-input">
        </div>
        <label class="layui-form-label">商品标题</label>
        <div class="layui-input-inline">
            <input type="text" name="productTitle" id="productTitle" value="${mv.product_title}" lay-ignore="true" autocomplete="off"
                   class="layui-input">
        </div>
        <label class="layui-form-label">商品热度</label>
        <div class="layui-input-inline">
            <select class="layui-select" id="isNew" name="isNew">
                <option value="-1">------请选择------</option>
                <option value="1">NEW</option>
                <option value="2">HOT</option>
            </select>
        </div>
        <script>
            $("#isNew").val("${mv.is_new!-1}")
        </script>
        <label class="layui-form-label">品牌</label>
        <div class="layui-input-inline">
            <input type="text" name="no5" id="brand" value="${mv.no5}" lay-ignore="true" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <!--<label class="layui-form-label">是否热门</label>
        <div class="layui-input-inline">
            <select class="layui-select" id="isHot" name="isHot">
                <option value="-1">&#45;&#45;&#45;&#45;&#45;&#45;请选择&#45;&#45;&#45;&#45;&#45;&#45;</option>
                <option value="0">是</option>
                <option value="1">否</option>
            </select>
        </div>
        <script>
            $("#isHot").val("${mv.is_hot!-1}")
        </script>-->
        <label class="layui-form-label">主页推荐</label>
        <div class="layui-input-inline">
            <select lay-filter="no2" class="layui-select" id="no2" name="no2">
                <option value="-1">------请选择------</option>
                <option value="0">是</option>
                <option value="1">否</option>
            </select>
        </div>
        <script>
            $("#no2").val("${mv.no2!-1}")
        </script>
        <div id="firstPageItem" style="display: none;">
            <label class="layui-form-label">主页栏目</label>
            <div class="layui-input-inline">
                <select class="layui-select" id="no3" name="no3">
                    <option value="-1">------请选择------</option>
                    <option value="1">精品商品</option>
                    <option value="2">超值推荐</option>
                    <option value="3">热卖商品</option>
                    <option value="4">新品上架</option>
                </select>
            </div>
        </div>
        <script>
            $("#no3").val("${mv.no3!-1}")
        </script>
        <label class="layui-form-label">显示优先级</label>
        <div class="layui-input-inline">
            <input type="number" name="no1" id="no1" value="${mv.no1}" autocomplete="off"
                   class="layui-input">
        </div>
        <label class="layui-form-label">最小包装</label>
        <div class="layui-input-inline">
            <input type="text" name="no6" id="no6" value="${mv.no6}" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">产地</label>
        <div class="layui-input-inline">
            <input type="text" name="no7" id="no7" value="${mv.no7}" autocomplete="off"
                   class="layui-input">
        </div>

        <label class="layui-form-label">生产日期</label>
        <div class="layui-input-inline">
            <input type="text" name="no8" id="no8" value="${mv.no8}" autocomplete="off"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">销售属性</label>
        <div class="layui-input-inline" id="attrDiv" style="padding-right: 5px; margin-left: 15px;">
            <button id="addAttrBtn" onclick="addAttrName()" class="layui-btn layui-btn-sm"
                    style="margin-left: -15px; margin-top: 2px" type="button">添加属性</button>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label control-label">SKU信息</label>
        <div class="layui-input-inline sku-table" style="width: 1000px;">
            <table class="layui-table">
                <thead>
                <tr><th width="10%">序号</th>
                    <th width="26%">SKU名称</th>
                    <th width="16%">销售价格</th>
                    <th width="16%">折扣价格</th>
                    <th width="16%">数量</th>
                    <th width="16%">SKU编号</th></tr>
                </thead>
                <tbody id="companyTable">
                </tbody>
            </table>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">上传图片</label>
        <div class="layui-input-block" id="uploadImg" style="padding-right: 5px; margin-left: 15px;">
            <div class="layui-upload">
                <button type="button" class="layui-btn" id="uploadButton">图片上传</button>
            </div>
        </div>
    </div>
    <input type="hidden" name="productAvatar" id="productAvatar" value="${mv.product_avatar}"><!--图片路径隐藏域-->

    <div id="showAnotherPeace" style="display:none;">
        ${mv.product_desc}
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品描述</label>
        <div class="layui-input-block">
                <div id="editor"></div>
        </div>
    </div>
    <input type="hidden" id="productDesc"><!--富文本信息影藏域-->

    <div id="showAnotherPeace2" style="display:none;">
        ${mv.no4}
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品属性</label>
        <div class="layui-input-block">
            <div id="editor2"></div>
        </div>
    </div>
    <input type="hidden" id="productAttr"><!--富文本信息影藏域-->
    <div class="layui-form-item" style="text-align: center">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="demo1">立即提交</button>
            <!--<button class="layui-btn layui-btn-primary layui-btn-radius" type="reset">重置</button>-->
        </div>
    </div>
        <script>
            layui.use(['form', 'layedit', 'laydate','upload'], function () {
                var form = layui.form
                    , layer = layui.layer
                    , layedit = layui.layedit
                    , laydate = layui.laydate
                    , upload = layui.upload;
                form.render();

                laydate.render({
                    elem: '#no8' //指定元素
                });

                //编辑页面显示
                var pk = $("#pk").val();
                var no3=$("#no3").val();
                console.log(no3)
                if(no3!=-1){
                    $("#firstPageItem").show();
                }
                if(pk!=null&&pk!=""){
                    selectData("${mv.product_type_first}",form,pk);
                    initAttrAndValue();//加载属性值
                    initSku();//加载sku
                    showImage();//加载图片
                }

                //多图片上传
                upload.render({
                    elem: '#uploadButton'
                    ,url: '/aliOSS/fileUpload'
                    ,data: {type: '产品图片'}
                    ,multiple: true
                    ,before: function(obj){
                        //预读本地文件示例，不支持ie8
                        /*obj.preview(function(index, file, result){
                            $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img" style="width: 100px;height: 80px;">')
                        });
                        console.log(obj)*/
                    }
                    ,done: function(res){
                        if(res.success){
                            console.log(res)
                            var opt= "<img src=\"//"+res.data[0].path+"\" style=\"width:100px;height:80px;\"><i class=\"layui-icon layui-unselect layui-tab-close\" onclick='removeImage(this)'>ဆ</i>";
                            $("#uploadButton").before(opt);
                        }
                        layer.msg(res.message)
                    }
                });
                //日期
                /*laydate.render({
                    elem: '#birthday'
                });*/


                //自定义验证规则
                /*form.verify({
                    title: function (value) {
                        if (value.length < 5) {
                            return '标题至少得5个字符啊';
                        }
                    },
                    notNull: function (value) {
                        if (value.length <= 0) {
                            return '信息必填';
                        }
                    }
                    , password: [
                        /^[\w_-]{6,16}$/
                        , '密码必须6到12位，且不能出现空格'
                    ]
                    , email: [
                        /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/
                        , '密码必须6到12位，且不能出现空格'
                    ]
                    , phone: [
                        /^[1][2,3,4,5,6,7,8,9][0-9]{9}$/
                        , '手机号码格式异常'
                    ]
                    , account: [
                        /^[A-Za-z0-9]{4,16}$/
                        , '请输入4位以上的英文或数字组合'
                    ]
                    , content: function (value) {
                        layedit.sync(editIndex);
                    }
                });*/

                //监听提交
                form.on('submit(demo1)', function (data) {
                    layui.use(['jquery'], function () {
                        var $ = jQuery = layui.$;
                        var postUrl = "/product/saveOrUpdate";
                        var strd = editor.txt.html().trim();
                        $("#productDesc").val(strd);
                        var strd2 = editor2.txt.html().trim();
                        $("#productAttr").val(strd2);
                        //获取图片路径
                        var allImg = $("#uploadImg").find("img");
                        var filePath="";
                        //console.log(allImg.length)
                        if(allImg.length>0){
                            for (var i = 0; i <allImg.length ; i++) {
                                filePath+=$(allImg[i]).attr("src").substring(2);
                                if(i!=allImg.length-1){
                                    filePath+=";";
                                }
                            }
                            $("#productAvatar").val(filePath);
                        }
                        var attrNameAndAttrValue=getAttrList();//获取属性及属性值
                        var skuList=getSkuList();//获取skud的信息
                        var data=$("#userForm").serialize();
                        data= decodeURIComponent(data,true);//防止中文乱码
                        var primary=DataDeal.formToJson(data);//转化为json
                        primary = JSON.parse(primary)
                        primary.productDesc=$("#productDesc").val();
                        primary.no4=$("#productAttr").val();
                        primary = JSON.stringify(primary);
                        //console.log(primary)
                        $.ajax({
                            url: postUrl,
                            type: 'post',
                            dataType:'json',
                            data: {'syProduct':primary,
                                'attrNameAndAttrValue':JSON.stringify(attrNameAndAttrValue),
                                'syProductSku':JSON.stringify(skuList)
                            },
                            success: function (resp) {
                                if(resp.code==200){
                                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                                    parent.initTable();//刷新表格数据
                                }
                                layer.msg(resp.message);
                            },
                            error: function (resp) {
                                layer.msg("未知错误");
                            }
                        });
                    });
                    return false;
                });

                //监听select下拉选择
                form.on('select(productTypeFirst)', function(data){
                    selectData(data.value,form);
                });
                //监听select下拉选择
                form.on('select(no2)', function(data){
                    if(data.value==0){
                        $("#firstPageItem").show();
                    }else{
                        $("#firstPageItem").hide();
                    }
                });
            });

            //二级联查的方法
            function selectData(productTypeParent,form,pk){
                $.ajax({
                    url:'/product/productTypeSecond',
                    type:'get',
                    data:{'productTypeParent':productTypeParent},
                    dataType:'json',
                    success:function (resp) {
                        var opt="<option value=\"-1\">输入二级分类名称搜索</option>";
                        for(var i=0;i<resp.data.length;i++){
                            opt+="<option value=\""+resp.data[i].pk+"\">"+resp.data[i].product_type_name+"</option>";
                        }
                        $("#productTypeSecond").html(opt);
                        if(pk!=""&&pk!=null&&pk!=undefined){
                            $("#productTypeSecond").val("${mv.product_type_second}");
                        }
                        form.render();
                    },
                    error: function (resp) {
                        layer.msg(resp.message);
                    }
                });
            }

            //图片回显的方法
            function showImage(){
                var filePath = "${mv.product_avatar}";
                if(filePath!=null&&filePath!=""){
                    var filePaths=filePath.split(";");
                    var opt="";
                    for (var i = 0; i <filePaths.length ; i++) {
                        opt+= "<img src=\"//"+filePaths[i]+"\" style=\"width:100px;height:80px;\"><i class=\"layui-icon layui-unselect layui-tab-close\" onclick='removeImage(this)'>ဆ</i>";
                    }
                    $("#uploadButton").before(opt);
                }
            }

            //移除图片
            function removeImage(value){
                $(value).prev().remove();
                $(value).remove();
            }

            //富文本
            var editor = null;
            var editor2 = null;
            $(function() {
                var E = window.wangEditor;
                editor = new E('#editor');
                editor.customConfig.uploadImgServer = '/aliOSS/fileUpload?type=产品描述富文本图片文件夹'; // 上传图片到阿里云服务器
                editor.customConfig.uploadFileName = 'file';
                editor.customConfig.zIndex = 100;
                editor.customConfig.uploadImgHooks = {
                    customInsert : function(insertImg, result, editor) {
                        var url = "//"+result.data[0].path;
                        insertImg(url);
                    }
                };
                editor.create()

                var ss = $("#showAnotherPeace").html();
                if (ss != null && ss != '' && ss != 'undefiend') {
                    editor.txt.html(ss);
                }

                editor2 = new E('#editor2');
                editor2.customConfig.uploadImgServer = '/aliOSS/fileUpload?type=产品属性富文本图片文件夹'; // 上传图片到阿里云服务器
                editor2.customConfig.uploadFileName = 'file';
                editor2.customConfig.zIndex = 100;
                editor2.customConfig.uploadImgHooks = {
                    customInsert : function(insertImg, result, editor) {
                        var url = "//"+result.data[0].path;
                        insertImg(url);
                    }
                };
                editor2.create()

                var ss2 = $("#showAnotherPeace2").html();
                if (ss2 != null && ss2 != '' && ss2 != 'undefiend') {
                    editor2.txt.html(ss2);
                }

            });

            //添加销售属性
            function addAttrName(){
                layer.open({
                    title:'添加销售属性',
                    content: '<input id="saleAttr" type="text">',
                    yes: function(index, layero){
                        var saleAttr =$("#saleAttr").val();
                        var opt="<div style=\"background-color: #f8f8f8;border:1px solid #e7eaec;width: 1000px\">"+
                            "<div class=\"row updel\">"+
                            "<label style='color: #FF00FF'>"+saleAttr+"</label>"+
                            "<i onclick=\"removeSaleAttr(this)\" class=\"layui-icon layui-unselect layui-tab-close\" style='float: right'>ဆ</i>"+
                            "</div><br>"+
                            "<div class=\"attr\" data='"+saleAttr+"'>"+
                            "<button type='button' class=\"layui-btn layui-btn-xs layui-btn-radius layui-btn-danger\" onclick=\"addAttrValue(this)\">"+
                            "属性值"+
                            "</button>"+
                            "</div>"+
                            "</div><br>"
                        $("#addAttrBtn").before(opt);
                        layer.close(index); //如果设定了yes回调，需进行手工关闭
                    }
                });
            }

            //删除销售属性
            function removeSaleAttr(value){
                $(value).parent().parent().next().remove();
                $(value).parent().parent().remove();
                createTable();
            }

            //添加属性的值
            function addAttrValue(value){
                layer.open({
                    title:'添加销售属性值',
                    content: '<input id="saleAttrValue" type="text">',
                    yes: function(index, layero){
                        var saleAttrValue =$("#saleAttrValue").val();
                        var opt="<a class=\"layui-btn layui-btn-primary layui-btn-sm\" data=\""+saleAttrValue+"\">"+
                            ""+saleAttrValue+"&nbsp;"+
                            "<i onclick=\"removeAttrValue(this)\" class=\"layui-icon layui-unselect layui-tab-close\">ဆ</i>"+
                            "</a>"
                        $(value).before(opt);
                        createTable();
                        layer.close(index); //如果设定了yes回调，需进行手工关闭
                    }
                });
            }

            //删除属性的值
            function removeAttrValue(value){
                $(value).parent().remove();
                createTable();
            }

            /**********************
             * 计算SKU信息
             *********************/
            function createTable(){
                //表头信息
                // var _header = "<thead><tr><th width='10%'>序号</th>";
                //表体信息
                var _body = "";
                //序号
                var _index = 0;

                var txt="";
                var v = $(".attr");
                var _skus = [];
                forAttr(v,0,txt,_skus);
                //console.log(_skus);
                $.each(_skus,function(i,value) {
                    _body += "<tr skuname='"+value+"'><td>"+(i+1)+"<input type='hidden' name='xh' value='"+(i+1)+"'></td>";
                    _body += "<td>"+value+"<input type='hidden' name='skuName' value='"+value+"'></td>";
                    _body += "<td><input style='width: 100%' name='skuPrice' required lay-verify='salePrice' type='text' value='0.00'></td>";
                    _body += "<td><input style='width: 100%' name='skuOffPrice' required lay-verify='offPrice' type='text' value='0.00'></td>";
                    _body += "<td><input style='width: 100%' name='skuNum' required lay-verify='number' type='text' value='99999'></td>";
                    _body += "<td><input style='width: 100%' name='skuCode' type='text'></td></tr>";
                });
                //_header+="<th width='32%'>SKU名称</th><th width='17%'>销售价格</th><th width='17%'>折扣价格</th>";
                // _header+="<th width='17%'>数量</th><th width='17%'>SKU编号</th></tr></thead>";

                $("#companyTable").html(_body);
            }

            /**********************
             * 计算SKU信息 嵌套算法
             *********************/
            function forAttr(p,t,v,skus){
                var _size = $(p[t]).children().size();
                $(p[t]).children().each(function(i,a){
                    if(t==0){ v="";}
                    if(i==_size-1){return;}
                    if(t+1 < p.size()){
                        if(i>0){
                            //console.log("1>>>:"+v);
                            v =v.substring(0,(v.lastIndexOf(";")));
                            v =v.substring(0,(v.lastIndexOf(";")+1));
                            //console.log("2>>>:"+v);
                        }
                        v +=$(a).attr("data")+";";
                        forAttr(p,t+1,v,skus);
                    }
                    //最后层输出
                    else if(p.size()==t+1){
                        skus.push(v+$(a).attr("data"));
                    }
                });
            }

            //获取属性及属性值列表
            function getAttrList(){
                var attlist =[];
                $(".attr").each(function(i,v){
                    var obj = new Object();
                    var _size = $(v).children().size();
                    var vs =[];
                    $(v).children().each(function(i,a){
                        if(i==_size-1){return;}
                        vs.push($(a).attr("data"));
                    });
                    obj.attrName = $(v).attr("data");
                    obj.attrValue = vs;
                    attlist.push(obj);
                });
                //console.log(JSON.stringify(attlist));
                var attrInfo = {'name':'attrInfo','value':JSON.stringify(attlist)};
                return attrInfo;
            }

            //获取SKU信息
            function getSkuList(){
                var skulist =[];
                $("#companyTable tr").each(function(i,tr){
                    var obj = new Object();
                    $(tr).find("input").each(function(j,ipt){
                        obj[$(ipt).attr("name")]=$(ipt).val();
                        //console.log($(ipt).attr("name")+":"+$(ipt).val());
                    });
                    skulist.push(obj);
                });
                var skuInfo = {'name':'skuInfo','value':JSON.stringify(skulist)};
                //console.log(JSON.stringify(skuInfo));
                return skuInfo;
            }

            var DataDeal = {
                //将从form中通过$('#refer').serialize()获取的值转成json
                formToJson: function (data) {
                    data=data.replace(/&/g,"\",\"");
                    data=data.replace(/=/g,"\":\"");
                    data="{\""+data+"\"}";
                    return data;
                }
            }

            //初始化产品属性信息
            function initAttrAndValue(){
                var attrNameAndValue='${attrNameAndValue}';
                var attrNameAndValue=JSON.parse(attrNameAndValue);
                var opt="";
                $.each(attrNameAndValue,function(i, e){
                    var attrName=e['attrName'];
                    var attrValue=e['attrValue'];
                    opt+="<div style=\"background-color: #f8f8f8;border:1px solid #e7eaec;width: 1000px\">"
                    opt+= "<div class=\"row updel\">"
                    opt+= "<label style='color: #FF00FF'>"+attrName+"</label>"
                    opt+="<i onclick=\"removeSaleAttr(this)\" class=\"layui-icon layui-unselect layui-tab-close\" style='float: right'>ဆ</i>"
                    opt+="</div><br>"
                    opt+="<div class=\"attr\" data='"+attrName+"'>"
                        $.each(attrValue,function(j, v) {
                            var value = v['attr_value'];
                            opt+="<a class=\"layui-btn layui-btn-primary layui-btn-sm\" data=\""+value+"\">"
                            opt+=""+value+"&nbsp;"
                            opt+="<i onclick=\"removeAttrValue(this)\" class=\"layui-icon layui-unselect layui-tab-close\">ဆ</i>"
                            opt+="</a>"
                        })
                    opt+="<button type='button' class=\"layui-btn layui-btn-xs layui-btn-radius layui-btn-danger\" onclick=\"addAttrValue(this)\">"
                    opt+="属性值"
                    opt+="</button>"
                    opt+="</div>"
                    opt+="</div><br>"
                })
                $("#addAttrBtn").before(opt);
            }

            //初始化产品SKU信息
            function initSku(){
                var skulist='${productSkuList}';
                var skulist=JSON.parse(skulist);
                var _body="";
                $.each(skulist,function(i,sku) {
                    //console.log(JSON.stringify(sku));
                    _body += "<tr skuname='"+sku['sku_name']+"'><td>"+sku['xh']+"<input type='hidden' name='xh' value='"+sku['xh']+"'></td>";
                    _body += "<td>"+sku['sku_name']+"<input type='hidden' name='skuName' value='"+sku['sku_name']+"'></td>";
                    _body += "<td><input style='width: 100%' name='skuPrice' required lay-verify='salePrice' type='text' value='"+(sku['sku_price'])+"'></td>";
                    _body += "<td><input style='width: 100%' name='skuOffPrice' required lay-verify='offPrice' type='text' value='"+(sku['sku_off_price'])+"'></td>";
                    _body += "<td><input style='width: 100%' name='skuNum' required lay-verify='number' type='text' value='"+sku['sku_num']+"'></td>";
                    _body += "<td><input style='width: 100%' name='skuCode' type='text' value='"+sku['sku_code']+"'></td></tr>";
                });
                $("#companyTable").html(_body);
            }
        </script>
    </div>
</form>
</body>
</html>